package cn.edu.cqupt.cxcy.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;
import cn.edu.cqupt.cxcy.dto.TeacImpl;
import cn.edu.cqupt.cxcy.model.Team;

/**
 * Servlet implementation class Teacshowinfo
 */
@WebServlet("/Teacshowinfo")
public class Teacshowinfo extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Teacshowinfo() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String id=request.getParameter("id");
		Team show=new TeacImpl().showinfoofteam(id);
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("team_name", show.getTe_name());
		map.put("team_mail", show.getTe_loname());
		map.put("team_logo", show.getTe_logo());
		map.put("team_explain", show.getTe_explain());
		map.put("team_time", show.getTe_ctime());
		JSONObject jsonObject = JSONObject.fromObject(map);
		PrintWriter out= response.getWriter();
		out.print(jsonObject.toString());
		
	}

}
